Skip to content

Conversation

Filkolev
Copy link

The getaddrinfo() function returns 0 on success or a non-zero error code on failure. For reference:

On Unix systems, errno is only set in the case where the return code is EAI_SYSTEM, therefore showing the errno code in all other cases would not provide meaningful information.

Print the return code of the function call along with errno to provide all the information needed to determine the cause of the error.

Add checks for the return code where they are missing.

The getaddrinfo() function returns 0 on success or a non-zero error code
on failure. For reference:
- https://man7.org/linux/man-pages/man3/getaddrinfo.3.html
- https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo

On Unix systems, errno is only set in the case where the return code is
EAI_SYSTEM, therefore showing the errno code in all other cases would
not provide meaningful information.

Print the return code of the function call along with errno to provide
all the information needed to determine the cause of the error.

Add checks for the return code where they are missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant